package pattern10;

/**
 * 观察者模式
 * @author wdl
 */
public class ObserverPattern {
    public static void main(String[] args) {
        ConcreteSubject subject=new ConcreteSubject();

        subject.attach(new ConcreteObserver("X",subject));
        subject.attach(new ConcreteObserver("Y",subject));
        subject.attach(new ConcreteObserver("Z",subject));

        subject.setSubjectState("ABC");
        subject.Notify();
    }
}
